// 路由-相关模块
import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'
import Home from '@/views/Home/index.vue'
import Search from '@/views/Search'
import Play from '@/views/Play'
import My from '@/views/My'
import SongList from '@/views/SongList'

Vue.use(VueRouter)
const routes = [
    {
        path: '/',
        redirect: '/layout'
    },
    {
        path: '/layout',
        component: Layout,
        redirect: '/layout/home',
        children: [
            {
                path: 'home', // /layout/home
                component: Home,
                meta: { // meta保存路由对象额外信息的
                    title: "首页",
                    active:0
                }
            },
          {
              name:'Search',
                path: 'search',
                component: Search,
                meta: {
                    title: "搜索",
                }
          },
          {
            name:'My',
              path: 'my',
              component: My,
              meta: {
                  title: "我的",
                  active:1
            }
            },
          
        ]
    },
    {
        path: '/play',
        component: Play,
    },
    {
        path: '/songlist',
        component: SongList
    },

]

const router = new VueRouter({
    routes
})

export default router